{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import yaml\n",
    "import json\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = '../stories/all_stories.yml'\n",
    "with open(path, 'r', encoding='utf-8') as f:\n",
    "    dataset = yaml.load(f.read(),Loader=yaml.Loader)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 输入\n",
    "    - Previous system action\n",
    "    - System Action\n",
    "    - Slots\n",
    "    - User intent entities"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Construct dataset map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def construct_dataset(dataset):\n",
    "    # 将数据集的 intent entities 以及action 的类别抽取出来\n",
    "    intent_set = ['PAD']\n",
    "    entities_set = ['PAD']\n",
    "    action_set = ['PAD']\n",
    "    for v in dataset:\n",
    "        worth = v['steps']\n",
    "        for i in worth:\n",
    "            for key, val in i.items():\n",
    "                if key  == 'intent':\n",
    "                    intent_set.append(val)\n",
    "                if key == \"action\":\n",
    "                    action_set.append(val)\n",
    "                if key == 'entities':\n",
    "                    if val:\n",
    "                        for i in val:\n",
    "                            for key , value in i.items():\n",
    "                                entities_set.append(key)\n",
    "    return set(intent_set), set(entities_set), set(action_set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "intent: {'Control-Oven_Mode', 'Control-RiceCooker_Mode', 'affirm', 'Control-AC_Mode', 'greet', 'Control-Curtain_Timing', 'Control-RiceCooker_State', 'Control-Lamp_Color', 'Control-Fan_State', 'Control-AC_Close', 'Control-Fan_Wind', 'inform_Lamp', 'Control-Lamp_Open', 'Control-RiceCooker_Timing', 'thanks', 'PAD', 'Control-Lamp_Close', 'inform_sensorvalue', 'Control-Humidifier_Timing', 'Control-AC_Temp', 'Control-Lamp_Timing', 'Control-Fan_Timing', 'inform_mode', 'Control-Humidifier_Gear', 'Control-AC_Wind', 'goodbye', 'whattodo', 'inform_AC', 'Control-Fan_Mode', 'Control-RangHood_State', 'Control-Lamp_Lightness', 'Control-Lamp_Mode', 'Control-Oven_State', 'whoareyou', 'Control-Humidifier_State', 'Control-Curtain_State', 'deny', 'Control-Oven_Temp', 'Control-AC_Timing', 'Control-AC_Open', 'inform_address', 'Control-Fan_Gear', 'inform_range'} \n",
      " inetent_len : 43\n",
      "entities: {'date_time', 'gear_level', 'target', 'operation', 'address', 'device', 'color', 'temperature', 'time', 'mode', 'PAD', 'range', 'sensorvalue'} \n",
      " entities_len : 13\n",
      "action: {'Control-Lamp_State', 'utter_answer_goodbye', 'Control-Oven_Mode', 'Control-RiceCooker_Mode', 'Control-AC_Mode', 'utter_answer_thanks', 'Control-Curtain_Timing', 'Control-RiceCooker_State', 'Control-Lamp_Color', 'Control-Fan_State', 'Control-Fan_Wind', 'utter_answer_whoareyou', 'Control-RiceCooker_Timing', 'PAD', 'utter_answer_greet', 'Control-Humidifier_Timing', 'Control-AC_Temp', 'Control-Lamp_Timing', 'Control-Fan_Timing', 'Control-Humidifier_Gear', 'Control-AC_Wind', 'Control-Fan_Mode', 'Control-RangHood_State', 'Control-Lamp_Lightness', 'Control-Lamp_Mode', 'Control-Oven_State', 'utter_answer_deny', 'Control-Humidifier_State', 'Control-Curtain_State', 'Control-Oven_Temp', 'utter_answer_whattodo', 'Control-AC_State', 'Control-AC_Timing', 'utter_answer_affirm', 'Control-Fan_Gear'} \n",
      " action_len : 35\n"
     ]
    }
   ],
   "source": [
    "intent, entities, action = construct_dataset(dataset)\n",
    "print('intent: {} \\n inetent_len : {}'.format(intent,len(intent)))\n",
    "print('entities: {} \\n entities_len : {}'.format(entities,len(entities)))\n",
    "print('action: {} \\n action_len : {}'.format(action, len(action)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建意图索引\n",
    "intent2id = {}\n",
    "for index, val in enumerate(intent):\n",
    "    intent2id.update({val:index})\n",
    "\n",
    "id2intent = {}\n",
    "for index, val in enumerate(intent):\n",
    "    id2intent.update({index:val})  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建槽位索引\n",
    "entities2id = {}\n",
    "for index, val in enumerate(entities):\n",
    "    entities2id.update({val:index})\n",
    "\n",
    "id2entities = {}\n",
    "for index, val in enumerate(entities):\n",
    "    id2entities.update({index:val}) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建动作索引\n",
    "action2id = {}\n",
    "for index, val in enumerate(action):\n",
    "    action2id.update({val:index})\n",
    "\n",
    "id2action = {}\n",
    "for index, val in enumerate(action):\n",
    "    id2action.update({index:val})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将label2id 转为字典以json文件储存\n",
    "char = {}\n",
    "char.update({'action2id' : action2id})\n",
    "char.update({'id2action' : id2action})\n",
    "char.update({'intent2id' : intent2id})\n",
    "char.update({'id2intent' : id2intent})\n",
    "char.update({'entities2id' : entities2id})\n",
    "char.update({'id2entities' : id2entities})\n",
    "\n",
    "with open('./DM_char.json', mode='w', encoding='utf-8') as f:\n",
    "    json.dump(char, f)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "  story# extract dataset\n",
    "    - max_history 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def split_data(dataset):\n",
    "    # 以对话历史最长为3分割，以数组形式储存数据\n",
    "    data_set = []\n",
    "    num = 0\n",
    "    for val in dataset:\n",
    "        data = val['steps']\n",
    "#         num += 1\n",
    "#          print(num)\n",
    "        for index in range(0,len(data),2):\n",
    "\n",
    "            previous_action = []\n",
    "            actions = []\n",
    "            slots = []\n",
    "            user_intent = []\n",
    "\n",
    "            # 当前状态\n",
    "            current_intent  =  data[index]['intent']\n",
    "            if 'entities' in data[index].keys():\n",
    "                current_slot = data[index]['entities']\n",
    "            elif 'entities' not in data[index].keys():\n",
    "                current_slot = []\n",
    "            current_action = data[index+1]['action']\n",
    "\n",
    "            # 前一时刻状态\n",
    "            pre1_intent = []\n",
    "            pre1_slot = []\n",
    "            pre1_action = []\n",
    "\n",
    "            # 前二时刻状态\n",
    "            pre2_intent = []\n",
    "            pre2_slot = []\n",
    "            pre2_action = [] \n",
    "\n",
    "            pre_history_1 = index-2\n",
    "            pre_history_2 = index-4\n",
    "\n",
    "            #判断对话历史是否存在\n",
    "            if pre_history_1 >= 0:\n",
    "                pre1_intent = data[pre_history_1]['intent']\n",
    "                if 'entities' in data[pre_history_1].keys():\n",
    "                    pre1_slot = data[pre_history_1]['entities']\n",
    "                pre1_action = data[pre_history_1+1]['action']\n",
    "\n",
    "            if pre_history_2 >= 0:\n",
    "                pre2_intent = data[pre_history_2]['intent']\n",
    "                if 'entities' in data[pre_history_2].keys():\n",
    "                    pre2_slot = data[pre_history_2]['entities']\n",
    "                pre2_action = data[pre_history_2+1]['action'] \n",
    "        \n",
    "            previous_action_sum = [pre1_action, pre2_action]\n",
    "            for i in previous_action_sum:\n",
    "                if i != []:\n",
    "                    previous_action.append(i)  \n",
    "            if previous_action == []:\n",
    "                previous_action = ['PAD']\n",
    "#             print('previous_action: ', previous_action)\n",
    "\n",
    "            \n",
    "            actions = [current_action]\n",
    "#             print('actions: ',actions)\n",
    "            \n",
    "            slots_sum = [current_slot , pre1_slot , pre2_slot]            \n",
    "            for i in slots_sum:\n",
    "                if i  != []:\n",
    "                    for val in i:\n",
    "                        for key, j in val.items():\n",
    "                            if key not in slots:\n",
    "                                slots.append((key))\n",
    "            if slots == []:\n",
    "                slots = ['PAD']\n",
    "#             print('slots:',slots)\n",
    "            \n",
    "            \n",
    "            user_intent_sum= [current_intent , pre1_intent , pre2_intent]\n",
    "            for i in user_intent_sum:\n",
    "                if i != []:\n",
    "                    user_intent.append(i)\n",
    "            if user_intent == []:\n",
    "                user_intent = ['PAD']\n",
    "#             print('user_intent: ',user_intent)\n",
    "\n",
    "            data_set.append({'previous_action':previous_action, 'slots':slots,'user_intent':user_intent, 'action':actions})\n",
    "    return data_set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "data_set = split_data(dataset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def trans2labelid(vocab,x):\n",
    "        max_len = len(vocab)\n",
    "        labels = [vocab[label] for label in x]\n",
    "        label_onehot = np.eye(max_len)[labels]\n",
    "        values = sum(label_onehot)\n",
    "        return values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def extract_conv_data(data_set):\n",
    "    dataset_previous_action = []\n",
    "    dataset_slots = []\n",
    "    dataset_user_intent = []\n",
    "    dataset_action = []\n",
    "    for i in data_set:\n",
    "        previous_action = i['previous_action']\n",
    "        dataset_previous_action.append(trans2labelid(action2id,previous_action))\n",
    "        slots = i['slots']\n",
    "        dataset_slots.append(trans2labelid(entities2id,slots))\n",
    "        user_intent = i['user_intent']\n",
    "        dataset_user_intent.append(trans2labelid(intent2id,user_intent))\n",
    "        action = i['action']\n",
    "        dataset_action.append(trans2labelid(action2id,action))\n",
    "    \n",
    "    return np.array(dataset_previous_action), np.array(dataset_slots), \\\n",
    "            np.array(dataset_user_intent), np.array(dataset_action)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "previous_action, slots, user_intent, action = extract_conv_data(data_set) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2.3.0'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "import jsonprevious_action_len = len(action2id)\n",
    "print(previous_action_len)\n",
    "slots_len = len(slots2id)\n",
    "print(slots_len)\n",
    "user_intent_len = len(intent2id)\n",
    "print(user_intent_len)\n",
    "import codecs\n",
    "import numpy as np\n",
    "import tensorflow as tf\n",
    "\n",
    "os.environ[\"CUDA_VISIBLE_DEVICES\"] = '0'\n",
    "gpus = tf.config.experimental.list_physical_devices(device_type='GPU')\n",
    "for gpu in gpus:\n",
    "    tf.config.experimental.set_memory_growth(gpu, True)\n",
    "tf.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "params = {\n",
    "    'batch_size': 32,\n",
    "    'lr' : 0.001,\n",
    "    'epochs': 500,\n",
    "    'drops' : [0.1]\n",
    "         }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33\n",
      "13\n",
      "39\n"
     ]
    }
   ],
   "source": [
    "previous_action_len = len(action2id)\n",
    "print(previous_action_len)\n",
    "slots_len = len(entities2id)\n",
    "print(slots_len)\n",
    "user_intent_len = len(intent2id)\n",
    "print(user_intent_len)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def Dataset(previous_action_inputs, slots_inputs,user_intent_inputs,pre_action):\n",
    "    dataset = tf.data.Dataset.from_tensor_slices(({\n",
    "    \"previous_action_inputs\" : previous_action_inputs,\n",
    "    \"slots_inputs\" : slots_inputs,\n",
    "    \"user_intent_inputs\" : user_intent_inputs\n",
    "    },\n",
    "    {\n",
    "        \"pre_action\" : pre_action\n",
    "    }))\n",
    "    dataset = dataset.batch(params['batch_size'])\n",
    "    return dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_dataset =  Dataset(previous_action, slots, user_intent, action)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BatchDataset shapes: ({previous_action_inputs: (None, 33), slots_inputs: (None, 13), user_intent_inputs: (None, 39)}, {pre_action: (None, 33)}), types: ({previous_action_inputs: tf.float64, slots_inputs: tf.float64, user_intent_inputs: tf.float64}, {pre_action: tf.float64})>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"functional_1\"\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "previous_action_inputs (InputLa [(None, 33)]         0                                            \n",
      "__________________________________________________________________________________________________\n",
      "slots_inputs (InputLayer)       [(None, 13)]         0                                            \n",
      "__________________________________________________________________________________________________\n",
      "user_intent_inputs (InputLayer) [(None, 39)]         0                                            \n",
      "__________________________________________________________________________________________________\n",
      "embedding (Embedding)           (None, 33, 32)       8192        previous_action_inputs[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "embedding_1 (Embedding)         (None, 13, 32)       8192        slots_inputs[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "embedding_2 (Embedding)         (None, 39, 32)       8192        user_intent_inputs[0][0]         \n",
      "__________________________________________________________________________________________________\n",
      "bidirectional (Bidirectional)   (None, 33, 64)       12672       embedding[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "bidirectional_1 (Bidirectional) (None, 13, 128)      37632       embedding_1[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "bidirectional_2 (Bidirectional) (None, 39, 256)      124416      embedding_2[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "layer_normalization (LayerNorma (None, 33, 64)       128         bidirectional[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "layer_normalization_1 (LayerNor (None, 13, 128)      256         bidirectional_1[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "layer_normalization_2 (LayerNor (None, 39, 256)      512         bidirectional_2[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "global_average_pooling1d (Globa (None, 64)           0           layer_normalization[0][0]        \n",
      "__________________________________________________________________________________________________\n",
      "global_average_pooling1d_1 (Glo (None, 128)          0           layer_normalization_1[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "global_average_pooling1d_2 (Glo (None, 256)          0           layer_normalization_2[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "concatenate (Concatenate)       (None, 448)          0           global_average_pooling1d[0][0]   \n",
      "                                                                 global_average_pooling1d_1[0][0] \n",
      "                                                                 global_average_pooling1d_2[0][0] \n",
      "__________________________________________________________________________________________________\n",
      "pre_action (Dense)              (None, 33)           14817       concatenate[0][0]                \n",
      "==================================================================================================\n",
      "Total params: 215,009\n",
      "Trainable params: 215,009\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "tf.keras.backend.clear_session()\n",
    "previous_action_inputs = tf.keras.layers.Input(shape=(previous_action_len,), name = 'previous_action_inputs')\n",
    "slots_inputs = tf.keras.layers.Input(shape = (slots_len,), name = 'slots_inputs')\n",
    "user_intent_inputs = tf.keras.layers.Input(shape = (user_intent_len,), name = 'user_intent_inputs')\n",
    "\n",
    "previous_action_embed = tf.keras.layers.Embedding(256,32)(previous_action_inputs)\n",
    "slots_embed = tf.keras.layers.Embedding(256,32)(slots_inputs)\n",
    "user_intent_embed = tf.keras.layers.Embedding(256,32)(user_intent_inputs)\n",
    "\n",
    "# utter_inputs = tf.keras.layers.concatenate([previous_action_embed,slots_embed,user_intent_embed],axis=1)\n",
    "bilstm_ac = tf.keras.layers.Bidirectional(tf.keras.layers.GRU(32,return_sequences=True))(previous_action_embed)\n",
    "bilstm_slot = tf.keras.layers.Bidirectional(tf.keras.layers.GRU(64,return_sequences=True))(slots_embed)\n",
    "bilstm_intent = tf.keras.layers.Bidirectional(tf.keras.layers.GRU(128,return_sequences=True))(user_intent_embed)\n",
    "\n",
    "x_ac = tf.keras.layers.LayerNormalization()(bilstm_ac)\n",
    "x_conv_ac = tf.keras.layers.GlobalAveragePooling1D()(x_ac)\n",
    "\n",
    "x_slot = tf.keras.layers.LayerNormalization()(bilstm_slot)\n",
    "x_conv_slot = tf.keras.layers.GlobalAveragePooling1D()(x_slot)\n",
    "\n",
    "x_intent = tf.keras.layers.LayerNormalization()(bilstm_intent)\n",
    "x_conv_intent = tf.keras.layers.GlobalAveragePooling1D()(x_intent)\n",
    "\n",
    "utter_inputs = tf.keras.layers.concatenate([x_conv_ac,x_conv_slot,x_conv_intent],axis=1)\n",
    "\n",
    "pre_action = tf.keras.layers.Dense(previous_action_len, activation='sigmoid',name = 'pre_action')(utter_inputs)\n",
    "model = tf.keras.Model([previous_action_inputs,slots_inputs,user_intent_inputs],pre_action)\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "losses = {'pre_action': 'sparse_categorical_crossentropy'}\n",
    "metrics = {'pre_action': ['accuracy']}\n",
    "optimizer = tf.keras.optimizers.Adam(params['lr'])\n",
    "model.compile(optimizer, loss=tf.keras.losses.categorical_crossentropy, metrics=metrics)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.6377 - accuracy: 0.0282\n",
      "Epoch 2/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0991 - accuracy: 0.0960\n",
      "Epoch 3/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0668 - accuracy: 0.0960\n",
      "Epoch 4/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0713 - accuracy: 0.1469\n",
      "Epoch 5/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0746 - accuracy: 0.1243\n",
      "Epoch 6/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0710 - accuracy: 0.1243\n",
      "Epoch 7/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0676 - accuracy: 0.1243\n",
      "Epoch 8/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0620 - accuracy: 0.1243\n",
      "Epoch 9/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0560 - accuracy: 0.1243\n",
      "Epoch 10/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 3.0513 - accuracy: 0.1243\n",
      "Epoch 11/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0480 - accuracy: 0.1243\n",
      "Epoch 12/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 3.0465 - accuracy: 0.1243\n",
      "Epoch 13/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0453 - accuracy: 0.1243\n",
      "Epoch 14/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0424 - accuracy: 0.1243\n",
      "Epoch 15/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0376 - accuracy: 0.1243\n",
      "Epoch 16/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0315 - accuracy: 0.1243\n",
      "Epoch 17/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0246 - accuracy: 0.1243\n",
      "Epoch 18/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0168 - accuracy: 0.1243\n",
      "Epoch 19/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 3.0077 - accuracy: 0.1243\n",
      "Epoch 20/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.9965 - accuracy: 0.1243\n",
      "Epoch 21/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.9828 - accuracy: 0.1243\n",
      "Epoch 22/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.9661 - accuracy: 0.1243\n",
      "Epoch 23/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.9455 - accuracy: 0.1243\n",
      "Epoch 24/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.9202 - accuracy: 0.1243\n",
      "Epoch 25/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.8894 - accuracy: 0.1243\n",
      "Epoch 26/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.8523 - accuracy: 0.1243\n",
      "Epoch 27/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.8086 - accuracy: 0.1243\n",
      "Epoch 28/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.7564 - accuracy: 0.1243\n",
      "Epoch 29/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.7113 - accuracy: 0.1243\n",
      "Epoch 30/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.6842 - accuracy: 0.1243\n",
      "Epoch 31/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.6491 - accuracy: 0.1299\n",
      "Epoch 32/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.6244 - accuracy: 0.1469\n",
      "Epoch 33/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.5923 - accuracy: 0.1808\n",
      "Epoch 34/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.5685 - accuracy: 0.1808\n",
      "Epoch 35/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.5319 - accuracy: 0.1921\n",
      "Epoch 36/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.5581 - accuracy: 0.1808\n",
      "Epoch 37/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.5084 - accuracy: 0.1412\n",
      "Epoch 38/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.4579 - accuracy: 0.0678\n",
      "Epoch 39/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.3985 - accuracy: 0.0678\n",
      "Epoch 40/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.3970 - accuracy: 0.0678\n",
      "Epoch 41/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.3591 - accuracy: 0.0678\n",
      "Epoch 42/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.3678 - accuracy: 0.0791\n",
      "Epoch 43/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.3423 - accuracy: 0.0847\n",
      "Epoch 44/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.3318 - accuracy: 0.1130\n",
      "Epoch 45/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.3165 - accuracy: 0.1130\n",
      "Epoch 46/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.2916 - accuracy: 0.2034\n",
      "Epoch 47/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.2631 - accuracy: 0.2260\n",
      "Epoch 48/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.2311 - accuracy: 0.2373\n",
      "Epoch 49/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.2453 - accuracy: 0.1017\n",
      "Epoch 50/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 2.2658 - accuracy: 0.1808\n",
      "Epoch 51/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1855 - accuracy: 0.2825\n",
      "Epoch 52/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1718 - accuracy: 0.2203\n",
      "Epoch 53/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1890 - accuracy: 0.2260\n",
      "Epoch 54/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 2.1242 - accuracy: 0.2373\n",
      "Epoch 55/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.2546 - accuracy: 0.2260\n",
      "Epoch 56/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1524 - accuracy: 0.1130\n",
      "Epoch 57/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1638 - accuracy: 0.1525\n",
      "Epoch 58/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 2.1024 - accuracy: 0.2938\n",
      "Epoch 59/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 2.1144 - accuracy: 0.2429\n",
      "Epoch 60/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 2.0343 - accuracy: 0.2994\n",
      "Epoch 61/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 2.1042 - accuracy: 0.2881\n",
      "Epoch 62/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 2.0105 - accuracy: 0.2712\n",
      "Epoch 63/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 1.9870 - accuracy: 0.2938\n",
      "Epoch 64/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 1.9193 - accuracy: 0.2712\n",
      "Epoch 65/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 1.8480 - accuracy: 0.3503\n",
      "Epoch 66/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 1.7326 - accuracy: 0.3729\n",
      "Epoch 67/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 1.6855 - accuracy: 0.3955\n",
      "Epoch 68/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 1.6125 - accuracy: 0.5141\n",
      "Epoch 69/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 1.6121 - accuracy: 0.4520\n",
      "Epoch 70/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 1.5310 - accuracy: 0.4915\n",
      "Epoch 71/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 1.4945 - accuracy: 0.4859\n",
      "Epoch 72/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 1.3971 - accuracy: 0.5198\n",
      "Epoch 73/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 1.3531 - accuracy: 0.5706\n",
      "Epoch 74/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 1.2949 - accuracy: 0.5819\n",
      "Epoch 75/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.2559 - accuracy: 0.5763\n",
      "Epoch 76/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.2091 - accuracy: 0.5932\n",
      "Epoch 77/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.1654 - accuracy: 0.5989\n",
      "Epoch 78/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.1623 - accuracy: 0.6045\n",
      "Epoch 79/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.1063 - accuracy: 0.5932\n",
      "Epoch 80/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.0710 - accuracy: 0.6271\n",
      "Epoch 81/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.0586 - accuracy: 0.6271\n",
      "Epoch 82/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.0196 - accuracy: 0.6554\n",
      "Epoch 83/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 1.0437 - accuracy: 0.6384\n",
      "Epoch 84/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.9952 - accuracy: 0.6441\n",
      "Epoch 85/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.9876 - accuracy: 0.6836\n",
      "Epoch 86/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.9735 - accuracy: 0.6667\n",
      "Epoch 87/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.9462 - accuracy: 0.6667\n",
      "Epoch 88/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.9243 - accuracy: 0.7062\n",
      "Epoch 89/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.9127 - accuracy: 0.7062\n",
      "Epoch 90/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.8879 - accuracy: 0.7119\n",
      "Epoch 91/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.9122 - accuracy: 0.7062\n",
      "Epoch 92/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.8891 - accuracy: 0.7232\n",
      "Epoch 93/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.9041 - accuracy: 0.6780\n",
      "Epoch 94/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.8724 - accuracy: 0.7119\n",
      "Epoch 95/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.8404 - accuracy: 0.7627\n",
      "Epoch 96/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.8152 - accuracy: 0.7175\n",
      "Epoch 97/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.8017 - accuracy: 0.7684\n",
      "Epoch 98/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.7783 - accuracy: 0.7797\n",
      "Epoch 99/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.7720 - accuracy: 0.7458\n",
      "Epoch 100/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.7414 - accuracy: 0.7910\n",
      "Epoch 101/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.7412 - accuracy: 0.7966\n",
      "Epoch 102/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.7126 - accuracy: 0.8079\n",
      "Epoch 103/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.7082 - accuracy: 0.8249\n",
      "Epoch 104/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6829 - accuracy: 0.8249\n",
      "Epoch 105/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6757 - accuracy: 0.8362\n",
      "Epoch 106/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6543 - accuracy: 0.8305\n",
      "Epoch 107/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6429 - accuracy: 0.8531\n",
      "Epoch 108/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6266 - accuracy: 0.8588\n",
      "Epoch 109/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.6119 - accuracy: 0.8588\n",
      "Epoch 110/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.5977 - accuracy: 0.8644\n",
      "Epoch 111/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.5833 - accuracy: 0.8644\n",
      "Epoch 112/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.5682 - accuracy: 0.8644\n",
      "Epoch 113/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.5557 - accuracy: 0.8644\n",
      "Epoch 114/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.5420 - accuracy: 0.8814\n",
      "Epoch 115/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5260 - accuracy: 0.8870\n",
      "Epoch 116/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5158 - accuracy: 0.8870\n",
      "Epoch 117/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5055 - accuracy: 0.8927\n",
      "Epoch 118/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4872 - accuracy: 0.8927\n",
      "Epoch 119/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.4740 - accuracy: 0.8927\n",
      "Epoch 120/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4631 - accuracy: 0.8927\n",
      "Epoch 121/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4608 - accuracy: 0.8870\n",
      "Epoch 122/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4509 - accuracy: 0.8983\n",
      "Epoch 123/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4681 - accuracy: 0.8870\n",
      "Epoch 124/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4850 - accuracy: 0.8531\n",
      "Epoch 125/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5423 - accuracy: 0.8418\n",
      "Epoch 126/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.4956 - accuracy: 0.8588\n",
      "Epoch 127/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4820 - accuracy: 0.8814\n",
      "Epoch 128/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4602 - accuracy: 0.8588\n",
      "Epoch 129/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4345 - accuracy: 0.8927\n",
      "Epoch 130/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4068 - accuracy: 0.8983\n",
      "Epoch 131/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3926 - accuracy: 0.8983\n",
      "Epoch 132/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3836 - accuracy: 0.9096\n",
      "Epoch 133/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.3708 - accuracy: 0.9096\n",
      "Epoch 134/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3668 - accuracy: 0.9096\n",
      "Epoch 135/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3575 - accuracy: 0.9153\n",
      "Epoch 136/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3626 - accuracy: 0.8927\n",
      "Epoch 137/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3915 - accuracy: 0.8870\n",
      "Epoch 138/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3999 - accuracy: 0.8870\n",
      "Epoch 139/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4133 - accuracy: 0.8701\n",
      "Epoch 140/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.4421 - accuracy: 0.8588\n",
      "Epoch 141/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5567 - accuracy: 0.7966\n",
      "Epoch 142/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.3915 - accuracy: 0.9096\n",
      "Epoch 143/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.4485 - accuracy: 0.8701\n",
      "Epoch 144/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.3701 - accuracy: 0.8701\n",
      "Epoch 145/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.3442 - accuracy: 0.8983\n",
      "Epoch 146/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.3305 - accuracy: 0.9153\n",
      "Epoch 147/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.3108 - accuracy: 0.9153\n",
      "Epoch 148/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2973 - accuracy: 0.9153\n",
      "Epoch 149/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2938 - accuracy: 0.9153\n",
      "Epoch 150/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2887 - accuracy: 0.9096\n",
      "Epoch 151/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2832 - accuracy: 0.9209\n",
      "Epoch 152/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2689 - accuracy: 0.9266\n",
      "Epoch 153/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.2727 - accuracy: 0.9209\n",
      "Epoch 154/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2623 - accuracy: 0.9266\n",
      "Epoch 155/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.2914 - accuracy: 0.9096\n",
      "Epoch 156/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2809 - accuracy: 0.9209\n",
      "Epoch 157/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2847 - accuracy: 0.9266\n",
      "Epoch 158/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2857 - accuracy: 0.9209\n",
      "Epoch 159/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2615 - accuracy: 0.9266\n",
      "Epoch 160/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2422 - accuracy: 0.9379\n",
      "Epoch 161/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2425 - accuracy: 0.9435\n",
      "Epoch 162/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2368 - accuracy: 0.9379\n",
      "Epoch 163/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2328 - accuracy: 0.9379\n",
      "Epoch 164/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2359 - accuracy: 0.9322\n",
      "Epoch 165/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2329 - accuracy: 0.9266\n",
      "Epoch 166/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2262 - accuracy: 0.9322\n",
      "Epoch 167/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2171 - accuracy: 0.9435\n",
      "Epoch 168/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2108 - accuracy: 0.9379\n",
      "Epoch 169/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1976 - accuracy: 0.9435\n",
      "Epoch 170/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1986 - accuracy: 0.9379\n",
      "Epoch 171/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1896 - accuracy: 0.9379\n",
      "Epoch 172/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1890 - accuracy: 0.9435\n",
      "Epoch 173/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1835 - accuracy: 0.9435\n",
      "Epoch 174/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1861 - accuracy: 0.9435\n",
      "Epoch 175/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1858 - accuracy: 0.9379\n",
      "Epoch 176/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1964 - accuracy: 0.9379\n",
      "Epoch 177/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1909 - accuracy: 0.9379\n",
      "Epoch 178/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1915 - accuracy: 0.9435\n",
      "Epoch 179/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1939 - accuracy: 0.9548\n",
      "Epoch 180/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2066 - accuracy: 0.9322\n",
      "Epoch 181/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2340 - accuracy: 0.9266\n",
      "Epoch 182/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.2633 - accuracy: 0.9040\n",
      "Epoch 183/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2169 - accuracy: 0.9266\n",
      "Epoch 184/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2812 - accuracy: 0.9153\n",
      "Epoch 185/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2465 - accuracy: 0.9379\n",
      "Epoch 186/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2517 - accuracy: 0.9209\n",
      "Epoch 187/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2622 - accuracy: 0.8927\n",
      "Epoch 188/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.3218 - accuracy: 0.9096\n",
      "Epoch 189/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.4070 - accuracy: 0.8588\n",
      "Epoch 190/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2550 - accuracy: 0.9322\n",
      "Epoch 191/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2803 - accuracy: 0.9266\n",
      "Epoch 192/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2891 - accuracy: 0.9040\n",
      "Epoch 193/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2042 - accuracy: 0.9435\n",
      "Epoch 194/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1936 - accuracy: 0.9548\n",
      "Epoch 195/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1804 - accuracy: 0.9435\n",
      "Epoch 196/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1753 - accuracy: 0.9548\n",
      "Epoch 197/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.2043 - accuracy: 0.9492\n",
      "Epoch 198/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.2044 - accuracy: 0.9435\n",
      "Epoch 199/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.2543 - accuracy: 0.9153\n",
      "Epoch 200/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.2147 - accuracy: 0.9322\n",
      "Epoch 201/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1850 - accuracy: 0.9548\n",
      "Epoch 202/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1672 - accuracy: 0.9605\n",
      "Epoch 203/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1584 - accuracy: 0.9492\n",
      "Epoch 204/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1487 - accuracy: 0.9605\n",
      "Epoch 205/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1429 - accuracy: 0.9492\n",
      "Epoch 206/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1409 - accuracy: 0.9605\n",
      "Epoch 207/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1377 - accuracy: 0.9605\n",
      "Epoch 208/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1351 - accuracy: 0.9661\n",
      "Epoch 209/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1330 - accuracy: 0.9548\n",
      "Epoch 210/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1313 - accuracy: 0.9605\n",
      "Epoch 211/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1293 - accuracy: 0.9605\n",
      "Epoch 212/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1276 - accuracy: 0.9605\n",
      "Epoch 213/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.1262 - accuracy: 0.9605\n",
      "Epoch 214/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1246 - accuracy: 0.9605\n",
      "Epoch 215/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1232 - accuracy: 0.9605\n",
      "Epoch 216/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1218 - accuracy: 0.9605\n",
      "Epoch 217/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1204 - accuracy: 0.9605\n",
      "Epoch 218/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1190 - accuracy: 0.9605\n",
      "Epoch 219/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1177 - accuracy: 0.9661\n",
      "Epoch 220/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1165 - accuracy: 0.9661\n",
      "Epoch 221/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1152 - accuracy: 0.9718\n",
      "Epoch 222/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1140 - accuracy: 0.9718\n",
      "Epoch 223/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1128 - accuracy: 0.9718\n",
      "Epoch 224/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1117 - accuracy: 0.9718\n",
      "Epoch 225/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1104 - accuracy: 0.9718\n",
      "Epoch 226/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1102 - accuracy: 0.9661\n",
      "Epoch 227/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1103 - accuracy: 0.9718\n",
      "Epoch 228/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1348 - accuracy: 0.9605\n",
      "Epoch 229/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1777 - accuracy: 0.9266\n",
      "Epoch 230/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2819 - accuracy: 0.9096\n",
      "Epoch 231/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1886 - accuracy: 0.9492\n",
      "Epoch 232/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1561 - accuracy: 0.9718\n",
      "Epoch 233/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1441 - accuracy: 0.9605\n",
      "Epoch 234/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.1324 - accuracy: 0.9661\n",
      "Epoch 235/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1187 - accuracy: 0.9661\n",
      "Epoch 236/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1147 - accuracy: 0.9718\n",
      "Epoch 237/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1096 - accuracy: 0.9605\n",
      "Epoch 238/500\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.1072 - accuracy: 0.9718\n",
      "Epoch 239/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1055 - accuracy: 0.9718\n",
      "Epoch 240/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1034 - accuracy: 0.9661\n",
      "Epoch 241/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1018 - accuracy: 0.9661\n",
      "Epoch 242/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1003 - accuracy: 0.9718\n",
      "Epoch 243/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0992 - accuracy: 0.9718\n",
      "Epoch 244/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0980 - accuracy: 0.9718\n",
      "Epoch 245/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0970 - accuracy: 0.9774\n",
      "Epoch 246/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0958 - accuracy: 0.9774\n",
      "Epoch 247/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0955 - accuracy: 0.9774\n",
      "Epoch 248/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0941 - accuracy: 0.9774\n",
      "Epoch 249/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0966 - accuracy: 0.9661\n",
      "Epoch 250/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0956 - accuracy: 0.9774\n",
      "Epoch 251/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1252 - accuracy: 0.9605\n",
      "Epoch 252/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1158 - accuracy: 0.9831\n",
      "Epoch 253/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1498 - accuracy: 0.9661\n",
      "Epoch 254/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1671 - accuracy: 0.9379\n",
      "Epoch 255/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1787 - accuracy: 0.9435\n",
      "Epoch 256/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2653 - accuracy: 0.9040\n",
      "Epoch 257/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2468 - accuracy: 0.9040\n",
      "Epoch 258/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.2573 - accuracy: 0.9153\n",
      "Epoch 259/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2863 - accuracy: 0.9209\n",
      "Epoch 260/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.2614 - accuracy: 0.9209\n",
      "Epoch 261/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2708 - accuracy: 0.9153\n",
      "Epoch 262/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1811 - accuracy: 0.9153\n",
      "Epoch 263/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1721 - accuracy: 0.9266\n",
      "Epoch 264/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2407 - accuracy: 0.9209\n",
      "Epoch 265/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2276 - accuracy: 0.9322\n",
      "Epoch 266/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1862 - accuracy: 0.9379\n",
      "Epoch 267/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1608 - accuracy: 0.9379\n",
      "Epoch 268/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1434 - accuracy: 0.9605\n",
      "Epoch 269/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1309 - accuracy: 0.9548\n",
      "Epoch 270/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1238 - accuracy: 0.9548\n",
      "Epoch 271/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1174 - accuracy: 0.9661\n",
      "Epoch 272/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1156 - accuracy: 0.9605\n",
      "Epoch 273/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.1115 - accuracy: 0.9718\n",
      "Epoch 274/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.1155 - accuracy: 0.9661\n",
      "Epoch 275/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1129 - accuracy: 0.9831\n",
      "Epoch 276/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1319 - accuracy: 0.9492\n",
      "Epoch 277/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1319 - accuracy: 0.9435\n",
      "Epoch 278/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1629 - accuracy: 0.9605\n",
      "Epoch 279/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.1859 - accuracy: 0.9153\n",
      "Epoch 280/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1414 - accuracy: 0.9718\n",
      "Epoch 281/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1132 - accuracy: 0.9661\n",
      "Epoch 282/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1119 - accuracy: 0.9718\n",
      "Epoch 283/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.1068 - accuracy: 0.9718\n",
      "Epoch 284/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1028 - accuracy: 0.9661\n",
      "Epoch 285/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0987 - accuracy: 0.9774\n",
      "Epoch 286/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0967 - accuracy: 0.9774\n",
      "Epoch 287/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0945 - accuracy: 0.9774\n",
      "Epoch 288/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0926 - accuracy: 0.9774\n",
      "Epoch 289/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0911 - accuracy: 0.9774\n",
      "Epoch 290/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0896 - accuracy: 0.9774\n",
      "Epoch 291/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0882 - accuracy: 0.9774\n",
      "Epoch 292/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0870 - accuracy: 0.9774\n",
      "Epoch 293/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0853 - accuracy: 0.9831\n",
      "Epoch 294/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0851 - accuracy: 0.9774\n",
      "Epoch 295/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0827 - accuracy: 0.9831\n",
      "Epoch 296/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0830 - accuracy: 0.9831\n",
      "Epoch 297/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0806 - accuracy: 0.9831\n",
      "Epoch 298/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0784 - accuracy: 0.9831\n",
      "Epoch 299/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0809 - accuracy: 0.9831\n",
      "Epoch 300/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0811 - accuracy: 0.9887\n",
      "Epoch 301/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1191 - accuracy: 0.9548\n",
      "Epoch 302/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1401 - accuracy: 0.9379\n",
      "Epoch 303/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.4026 - accuracy: 0.8814\n",
      "Epoch 304/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.5055 - accuracy: 0.8079\n",
      "Epoch 305/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.3648 - accuracy: 0.8757\n",
      "Epoch 306/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2971 - accuracy: 0.9153\n",
      "Epoch 307/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2155 - accuracy: 0.9379\n",
      "Epoch 308/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.4740 - accuracy: 0.8588\n",
      "Epoch 309/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2032 - accuracy: 0.9435\n",
      "Epoch 310/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.2370 - accuracy: 0.9096\n",
      "Epoch 311/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1689 - accuracy: 0.9605\n",
      "Epoch 312/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1323 - accuracy: 0.9605\n",
      "Epoch 313/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1139 - accuracy: 0.9718\n",
      "Epoch 314/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1059 - accuracy: 0.9831\n",
      "Epoch 315/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0987 - accuracy: 0.9774\n",
      "Epoch 316/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0941 - accuracy: 0.9718\n",
      "Epoch 317/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0906 - accuracy: 0.9718\n",
      "Epoch 318/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0868 - accuracy: 0.9831\n",
      "Epoch 319/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0831 - accuracy: 0.9831\n",
      "Epoch 320/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0807 - accuracy: 0.9831\n",
      "Epoch 321/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0785 - accuracy: 0.9831\n",
      "Epoch 322/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0762 - accuracy: 0.9831\n",
      "Epoch 323/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0762 - accuracy: 0.9831\n",
      "Epoch 324/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0743 - accuracy: 0.9831\n",
      "Epoch 325/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0736 - accuracy: 0.9831\n",
      "Epoch 326/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0728 - accuracy: 0.9831\n",
      "Epoch 327/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0770 - accuracy: 0.9774\n",
      "Epoch 328/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0725 - accuracy: 0.9774\n",
      "Epoch 329/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0692 - accuracy: 0.9774\n",
      "Epoch 330/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0652 - accuracy: 0.9944\n",
      "Epoch 331/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0647 - accuracy: 0.9944\n",
      "Epoch 332/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0631 - accuracy: 0.9944\n",
      "Epoch 333/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0667 - accuracy: 0.9887\n",
      "Epoch 334/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0750 - accuracy: 0.9718\n",
      "Epoch 335/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.0735 - accuracy: 0.9887\n",
      "Epoch 336/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.0728 - accuracy: 0.9774\n",
      "Epoch 337/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0691 - accuracy: 0.9887\n",
      "Epoch 338/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0601 - accuracy: 0.9831\n",
      "Epoch 339/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0571 - accuracy: 0.9831\n",
      "Epoch 340/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0577 - accuracy: 0.9944\n",
      "Epoch 341/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0692 - accuracy: 0.9718\n",
      "Epoch 342/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0735 - accuracy: 0.9605\n",
      "Epoch 343/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0729 - accuracy: 0.9661\n",
      "Epoch 344/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0670 - accuracy: 0.9944\n",
      "Epoch 345/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0569 - accuracy: 0.9831\n",
      "Epoch 346/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0521 - accuracy: 0.9831\n",
      "Epoch 347/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0531 - accuracy: 0.9944\n",
      "Epoch 348/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0580 - accuracy: 0.9887\n",
      "Epoch 349/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0673 - accuracy: 0.9831\n",
      "Epoch 350/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0765 - accuracy: 0.9887\n",
      "Epoch 351/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1051 - accuracy: 0.9605\n",
      "Epoch 352/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1369 - accuracy: 0.9718\n",
      "Epoch 353/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1836 - accuracy: 0.9266\n",
      "Epoch 354/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0919 - accuracy: 0.9718\n",
      "Epoch 355/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1068 - accuracy: 0.9661\n",
      "Epoch 356/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1048 - accuracy: 0.9661\n",
      "Epoch 357/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0880 - accuracy: 0.9887\n",
      "Epoch 358/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0730 - accuracy: 0.9774\n",
      "Epoch 359/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0644 - accuracy: 0.9831\n",
      "Epoch 360/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0624 - accuracy: 0.9831\n",
      "Epoch 361/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0579 - accuracy: 0.9944\n",
      "Epoch 362/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0549 - accuracy: 0.9944\n",
      "Epoch 363/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0533 - accuracy: 0.9831\n",
      "Epoch 364/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0515 - accuracy: 0.9944\n",
      "Epoch 365/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0532 - accuracy: 0.9774\n",
      "Epoch 366/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0497 - accuracy: 0.9944\n",
      "Epoch 367/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0484 - accuracy: 0.9831\n",
      "Epoch 368/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0478 - accuracy: 0.9944\n",
      "Epoch 369/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0468 - accuracy: 0.9831\n",
      "Epoch 370/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0545 - accuracy: 0.9887\n",
      "Epoch 371/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0541 - accuracy: 0.9887\n",
      "Epoch 372/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0675 - accuracy: 0.9661\n",
      "Epoch 373/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0596 - accuracy: 0.9831\n",
      "Epoch 374/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0567 - accuracy: 0.9887\n",
      "Epoch 375/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0490 - accuracy: 0.9831\n",
      "Epoch 376/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0438 - accuracy: 0.9944\n",
      "Epoch 377/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0415 - accuracy: 0.9944\n",
      "Epoch 378/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0399 - accuracy: 0.9944\n",
      "Epoch 379/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0403 - accuracy: 0.9944\n",
      "Epoch 380/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0460 - accuracy: 0.9831\n",
      "Epoch 381/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0603 - accuracy: 0.9661\n",
      "Epoch 382/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0705 - accuracy: 0.9718\n",
      "Epoch 383/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0859 - accuracy: 0.9605\n",
      "Epoch 384/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0970 - accuracy: 0.9718\n",
      "Epoch 385/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0758 - accuracy: 0.9774\n",
      "Epoch 386/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0476 - accuracy: 0.9831\n",
      "Epoch 387/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0506 - accuracy: 0.9831\n",
      "Epoch 388/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0508 - accuracy: 0.9887\n",
      "Epoch 389/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0479 - accuracy: 0.9774\n",
      "Epoch 390/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0434 - accuracy: 0.9944\n",
      "Epoch 391/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0411 - accuracy: 0.9887\n",
      "Epoch 392/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0531 - accuracy: 0.9661\n",
      "Epoch 393/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0578 - accuracy: 0.9774\n",
      "Epoch 394/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0770 - accuracy: 0.9605\n",
      "Epoch 395/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0892 - accuracy: 0.9661\n",
      "Epoch 396/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0642 - accuracy: 0.9831\n",
      "Epoch 397/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0482 - accuracy: 0.9831\n",
      "Epoch 398/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0441 - accuracy: 0.9831\n",
      "Epoch 399/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0489 - accuracy: 0.9887\n",
      "Epoch 400/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0426 - accuracy: 0.9887\n",
      "Epoch 401/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0429 - accuracy: 0.9944\n",
      "Epoch 402/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0421 - accuracy: 0.9887\n",
      "Epoch 403/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0480 - accuracy: 0.9944\n",
      "Epoch 404/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0410 - accuracy: 0.9887\n",
      "Epoch 405/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0360 - accuracy: 0.9944\n",
      "Epoch 406/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0336 - accuracy: 0.9944\n",
      "Epoch 407/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0323 - accuracy: 1.0000\n",
      "Epoch 408/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0355 - accuracy: 0.9944\n",
      "Epoch 409/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.0486 - accuracy: 0.9831\n",
      "Epoch 410/500\n",
      "6/6 [==============================] - 0s 18ms/step - loss: 0.0967 - accuracy: 0.9605\n",
      "Epoch 411/500\n",
      "6/6 [==============================] - 0s 19ms/step - loss: 0.1288 - accuracy: 0.9718\n",
      "Epoch 412/500\n",
      "6/6 [==============================] - 0s 17ms/step - loss: 0.1583 - accuracy: 0.9605\n",
      "Epoch 413/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1050 - accuracy: 0.9548\n",
      "Epoch 414/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.0832 - accuracy: 0.9831\n",
      "Epoch 415/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0591 - accuracy: 0.9831\n",
      "Epoch 416/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0484 - accuracy: 0.9831\n",
      "Epoch 417/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0489 - accuracy: 0.9944\n",
      "Epoch 418/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0415 - accuracy: 0.9774\n",
      "Epoch 419/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.0359 - accuracy: 0.9944\n",
      "Epoch 420/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.0327 - accuracy: 1.0000\n",
      "Epoch 421/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0309 - accuracy: 1.0000\n",
      "Epoch 422/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0301 - accuracy: 0.9944\n",
      "Epoch 423/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0323 - accuracy: 1.0000\n",
      "Epoch 424/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0487 - accuracy: 0.9718\n",
      "Epoch 425/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0664 - accuracy: 0.9774\n",
      "Epoch 426/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1312 - accuracy: 0.9322\n",
      "Epoch 427/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1569 - accuracy: 0.9492\n",
      "Epoch 428/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.1071 - accuracy: 0.9774\n",
      "Epoch 429/500\n",
      "6/6 [==============================] - 0s 14ms/step - loss: 0.1012 - accuracy: 0.9548\n",
      "Epoch 430/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0611 - accuracy: 0.9774\n",
      "Epoch 431/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0489 - accuracy: 0.9831\n",
      "Epoch 432/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0413 - accuracy: 0.9944\n",
      "Epoch 433/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0368 - accuracy: 1.0000\n",
      "Epoch 434/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0335 - accuracy: 1.0000\n",
      "Epoch 435/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0313 - accuracy: 1.0000\n",
      "Epoch 436/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0293 - accuracy: 1.0000\n",
      "Epoch 437/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0281 - accuracy: 1.0000\n",
      "Epoch 438/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0279 - accuracy: 0.9944\n",
      "Epoch 439/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0304 - accuracy: 0.9887\n",
      "Epoch 440/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0459 - accuracy: 0.9718\n",
      "Epoch 441/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0588 - accuracy: 0.9831\n",
      "Epoch 442/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0824 - accuracy: 0.9605\n",
      "Epoch 443/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0789 - accuracy: 0.9774\n",
      "Epoch 444/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0711 - accuracy: 0.9774\n",
      "Epoch 445/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0482 - accuracy: 0.9774\n",
      "Epoch 446/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0415 - accuracy: 0.9831\n",
      "Epoch 447/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0376 - accuracy: 1.0000\n",
      "Epoch 448/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0304 - accuracy: 1.0000\n",
      "Epoch 449/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0280 - accuracy: 1.0000\n",
      "Epoch 450/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0263 - accuracy: 1.0000\n",
      "Epoch 451/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0252 - accuracy: 1.0000\n",
      "Epoch 452/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0244 - accuracy: 1.0000\n",
      "Epoch 453/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0247 - accuracy: 1.0000\n",
      "Epoch 454/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0315 - accuracy: 0.9944\n",
      "Epoch 455/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0603 - accuracy: 0.9831\n",
      "Epoch 456/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1186 - accuracy: 0.9379\n",
      "Epoch 457/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1614 - accuracy: 0.9435\n",
      "Epoch 458/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1717 - accuracy: 0.9605\n",
      "Epoch 459/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1772 - accuracy: 0.9322\n",
      "Epoch 460/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.1166 - accuracy: 0.9605\n",
      "Epoch 461/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0878 - accuracy: 0.9661\n",
      "Epoch 462/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0996 - accuracy: 0.9661\n",
      "Epoch 463/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0711 - accuracy: 0.9887\n",
      "Epoch 464/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0651 - accuracy: 0.9831\n",
      "Epoch 465/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0633 - accuracy: 0.9831\n",
      "Epoch 466/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0574 - accuracy: 0.9887\n",
      "Epoch 467/500\n",
      "6/6 [==============================] - 0s 7ms/step - loss: 0.0539 - accuracy: 0.9831\n",
      "Epoch 468/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0510 - accuracy: 0.9831\n",
      "Epoch 469/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0470 - accuracy: 0.9944\n",
      "Epoch 470/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0434 - accuracy: 0.9831\n",
      "Epoch 471/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0409 - accuracy: 0.9831\n",
      "Epoch 472/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0383 - accuracy: 0.9944\n",
      "Epoch 473/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0359 - accuracy: 0.9944\n",
      "Epoch 474/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0341 - accuracy: 0.9944\n",
      "Epoch 475/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0324 - accuracy: 0.9944\n",
      "Epoch 476/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.0309 - accuracy: 0.9944\n",
      "Epoch 477/500\n",
      "6/6 [==============================] - 0s 13ms/step - loss: 0.0296 - accuracy: 0.9944\n",
      "Epoch 478/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0283 - accuracy: 0.9944\n",
      "Epoch 479/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0272 - accuracy: 1.0000\n",
      "Epoch 480/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0262 - accuracy: 1.0000\n",
      "Epoch 481/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0255 - accuracy: 1.0000\n",
      "Epoch 482/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0248 - accuracy: 0.9944\n",
      "Epoch 483/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0263 - accuracy: 0.9887\n",
      "Epoch 484/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.0331 - accuracy: 0.9944\n",
      "Epoch 485/500\n",
      "6/6 [==============================] - 0s 11ms/step - loss: 0.0626 - accuracy: 0.9831\n",
      "Epoch 486/500\n",
      "6/6 [==============================] - 0s 10ms/step - loss: 0.1117 - accuracy: 0.9605\n",
      "Epoch 487/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1830 - accuracy: 0.9266\n",
      "Epoch 488/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1679 - accuracy: 0.9379\n",
      "Epoch 489/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1875 - accuracy: 0.9266\n",
      "Epoch 490/500\n",
      "6/6 [==============================] - 0s 12ms/step - loss: 0.1843 - accuracy: 0.9322\n",
      "Epoch 491/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1360 - accuracy: 0.9548\n",
      "Epoch 492/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.1413 - accuracy: 0.9661\n",
      "Epoch 493/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0826 - accuracy: 0.9887\n",
      "Epoch 494/500\n",
      "6/6 [==============================] - 0s 9ms/step - loss: 0.0626 - accuracy: 0.9774\n",
      "Epoch 495/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0608 - accuracy: 0.9831\n",
      "Epoch 496/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0365 - accuracy: 1.0000\n",
      "Epoch 497/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0353 - accuracy: 1.0000\n",
      "Epoch 498/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0297 - accuracy: 1.0000\n",
      "Epoch 499/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0278 - accuracy: 1.0000\n",
      "Epoch 500/500\n",
      "6/6 [==============================] - 0s 8ms/step - loss: 0.0265 - accuracy: 1.0000\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x7f2178f2bf10>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fit(train_dataset,epochs=params['epochs'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.save_weights('../DM_model_weight/DM_weight_629.h5')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
